﻿@namespace SwashbucklerDiary.Rcl.Components
@inherits MediaWaterfallBase

<div>
    <wc-waterfall @ref="elementReference" gap="@Gap" cols="@Cols">
        @foreach (var item in LoadedItems)
        {
            <img @key="item.ResourceUri" class="image-card rounded-lg" src="@item.ResourceUri" />
        }
    </wc-waterfall>

    <MInfiniteScroll @ref="mInfiniteScroll"
                     Class="@($"{(HasMore?"":"py-0")}")"
                     OnLoad="@OnLoad"
                     Parent="@($"#{ScrollElementId}")"
                     EmptyText="@(string.Empty)"
                     LoadingText="@(string.Empty)">
        <LoadMoreContent Context="load">
            <MButton Icon="true"
                     OnClick="@load">
                <MIcon>mdi-reload</MIcon>
            </MButton>
        </LoadMoreContent>
    </MInfiniteScroll>
</div>

<EmptyResult Show="Value.Count == 0"
             Text="@(I18n.T("FileBrowse.Image.NoImage"))">
</EmptyResult>

<PreviewImageDialog @bind-Visible="showPreviewImage"
                    Src="@previewImageSrc">
</PreviewImageDialog>
